package com.itboye.mengwu.app.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.core.utils.XImageLoader;
import com.itboye.mengwu.R;
import com.itboye.mengwu.data.model.GoodsListModel;

/** GirdView 数据适配器 */
public class GoodsCollectionAdapter extends BaseAdapter {
	Context context;

	ArrayList<GoodsListModel.GoodsList> list;

	public GoodsCollectionAdapter(Context _context, ArrayList<GoodsListModel.GoodsList> _list) {
		this.list = _list;
		this.context = _context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Holder holder=null;
		if(convertView==null){
			holder=new Holder();
			convertView=LayoutInflater.from(context).inflate(R.layout.item_collectionofcontent, null);
					/**
					 * item_goodscomment_nickname,item_goodscomment_introduction,item_goodscomment_goods_date,item_goodscomment_goods_color,item_goodscomment_goods_size
					 */
			holder.isSelected=(ImageView) convertView.findViewById(R.id.isselected);
//			holder.goods_list_goodstv=(TextView) convertView.findViewById(R.id.goods_list_goodstv);
//			holder.new_price_symbol=(TextView) convertView.findViewById(R.id.new_price_symbol);
//			holder.goods_list_image=(ImageView) convertView.findViewById(R.id.goods_list_image);
			convertView.setTag(holder);
		}else{
			holder=(Holder) convertView.getTag();
		}
//		holder.goods_list_goodstv.setText(list.get(position).getName());
//		holder.new_price_symbol.setText(list.get(position).getPrice());
//		holder.goods_list_goodstv.setText(list.get(position).getTotal_sales());
//		XImageLoader.load(list.get(position).getImg(), holder.goods_list_image);
		return convertView;
	}
	
	class Holder{
		ImageView goods_list_image,isSelected;TextView goods_list_goodstv,item_goodscomment_introduction,item_goodscomment_goods_date,new_price_symbol,item_goodscomment_goods_size;
	}
}